package com.github.prontera.domain.enums;

import com.github.prontera.common.mybatis.handler.CodeEnum;

/**
 * 通用枚举类型
 */
public enum OrderStatusEnum implements CodeEnum<OrderStatusEnum> {

	CONFIRMED(0, "待确认"), CARRY(1, "进行中"), FINISHED(3, "已经结束"), REFUNDS(4, "退款中");

	private int code;
	private String desc;
	

	/**
     * 通过枚举<code>name</code>获取枚举
     */
    public static OrderStatusEnum getEnumByCode(Integer code) {
    	if(code==null){
    		return null;
    	}
        for (OrderStatusEnum enumm : OrderStatusEnum.values()) {
            if (enumm.getCode()==code.intValue()) {
                return enumm;
            }
        }
        return null;
    }
	
	private OrderStatusEnum(int code, String desc) {
		this.code = code;
		this.desc=desc;
	}

	@Override
	public int getCode() {
		return code;
	}

	public String getDesc() {
		return desc;
	}

}
